﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hfabase.Configs
{
    /// <summary>
    /// 配置接口
    /// </summary>
    public interface IConfig
    {
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="configFile">要加载的文件路径，如果为空则自行处理</param>
        /// <returns></returns>
        bool Load(string configFilePath = null);

        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="newConfigFilePath">新文件路径,如果为空，表示默认的文件路径</param>
        /// <returns></returns>
        bool Save(string newConfigFilePath = null);

        /// <summary>
        /// 还原默认配置
        /// </summary>
        /// <param name="configFile"></param>
        /// <returns></returns>
        bool Restore(string configFilePath = null);

        /// <summary>
        /// 获取指定结点的值
        /// </summary>
        /// <param name="path">结点路径</param>
        /// <returns></returns>
        string GetNodeValue(string path);

        /// <summary>
        /// 获取指定结点的属性值
        /// </summary>
        /// <param name="path"></param>
        /// <param name="attrName"></param>
        /// <returns></returns>
        string GetNodeAttrValue(string path, string attrName);

        /// <summary>
        /// 设置指定结点的值
        /// </summary>
        /// <param name="path"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        bool SetNodeValue(string path, string value);

        /// <summary>
        /// 设置指定结点的属性的值
        /// </summary>
        /// <param name="path"></param>
        /// <param name="attrName"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        bool SetNodeAttrValue(string path, string attrName, string value);

    }
}
